<template>
  <view class="cont">
    <rich-text :nodes="currentArticle.content"></rich-text>
  </view>
</template>
<script>
import { getArticleDetail } from '@/api/service.js';
export default {
  data() {
    return {
      currentArticle: {}
    };
  },
  onLoad(options) {
    if (options && options.articleId) {
      getArticleDetail(options.articleId).then((res) => {
        if (res.code !== 0) {
          uni.showToast({ title: '获取文章详情失败' });
          return;
        }
        this.currentArticle = res.data;
      });
    } else {
      uni.showModal({
        title: '提示',
        content: '文章id不存在'
      });
    }
  }
};
</script>
<style lang="scss" scoped>
.cont {
  width: 700rpx;
  margin: auto;
  overflow: scroll;
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
}
</style>
